package cz.idsv.web.mvc.model.service;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;

import cz.idsv.web.mvc.model.dao.ShopDao;
import cz.idsv.web.mvc.model.entity.ShopEntity;


@Service("ShopService")
public class ShopImpl implements ShopService {

	@Autowired()
	private ShopDao shopDao;
	
	
	public Collection<ShopEntity> findShop() throws DataAccessException{
		return shopDao.findShop();
	}

	public void save(ShopEntity  shopEntity) {
		 shopDao.save(shopEntity);
	}

	@Secured ({"ROLE_ADMIN"})
	public void delete( ShopEntity  shopEntity) {
		 shopDao.delete( shopEntity);
	}

	public  ShopEntity findShopById(Integer id)
			throws DataAccessException {
		return  shopDao.findShopById(id);
	}

	public  Collection<ShopEntity> findShopByName(String name)
			throws DataAccessException {
		return  shopDao.findShopByName(name);
	}

}
	